/***************************************************************************
 *            menu.c
 *
 *  Wed Feb 18 14:36:09 2009
 *  Copyright  2009  juanra
 *  <juanra@<host>>
 ****************************************************************************/

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */
 
 
#include "menu.h"

GtkWidget*
create_menu ( GtkAccelGroup* accel_group, GSList* list )
{
	GtkWidget* menu_bar;
	GtkWidget* file_menu;
	GtkWidget* edit_menu;
	GtkWidget* view_menu;
	GtkWidget* help_menu;
	GtkWidget* menu_item;
	
	menu_bar = gtk_menu_bar_new();
	file_menu = gtk_menu_new();
	edit_menu = gtk_menu_new();
	view_menu = gtk_menu_new();
	help_menu = gtk_menu_new();
	
	/*
	 File menu
	 */
	menu_item = gtk_menu_item_new_with_mnemonic( N_("_File") );
	gtk_menu_item_set_submenu( GTK_MENU_ITEM( menu_item ), file_menu );
	gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), menu_item );
	menu_item = gtk_image_menu_item_new_from_stock( GTK_STOCK_CONNECT, accel_group );
	gtk_menu_shell_append( GTK_MENU_SHELL( file_menu ), menu_item );
	menu_item = gtk_image_menu_item_new_from_stock( GTK_STOCK_DISCONNECT, accel_group );
	gtk_menu_shell_append( GTK_MENU_SHELL( file_menu ), menu_item );
	gtk_menu_shell_append( GTK_MENU_SHELL( file_menu ), gtk_separator_menu_item_new() );
	menu_item = gtk_image_menu_item_new_from_stock( GTK_STOCK_QUIT, accel_group );
	gtk_menu_shell_append( GTK_MENU_SHELL( file_menu ), menu_item );
	g_signal_connect( G_OBJECT( menu_item ), "activate", G_CALLBACK( safe_quit ), NULL );
	
	/*
	 Edit menu
	 */
	menu_item = gtk_menu_item_new_with_mnemonic( N_("_Edit") );
	gtk_menu_item_set_submenu( GTK_MENU_ITEM( menu_item ), edit_menu );
	gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), menu_item );
	menu_item = gtk_image_menu_item_new_from_stock( GTK_STOCK_PREFERENCES, accel_group );
	gtk_menu_shell_append( GTK_MENU_SHELL( edit_menu ), menu_item );
	
	/*
	 View menu
	 */
	menu_item = gtk_menu_item_new_with_mnemonic( N_("_View") );
	gtk_menu_item_set_submenu( GTK_MENU_ITEM( menu_item ), view_menu );
	gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), menu_item );
	menu_item = gtk_radio_menu_item_new_with_mnemonic( NULL, N_("_Music files") );
	gtk_menu_shell_append( GTK_MENU_SHELL( view_menu ), menu_item );
	menu_item = gtk_radio_menu_item_new_with_mnemonic_from_widget( GTK_RADIO_MENU_ITEM( menu_item ), N_("_Data files") );
	gtk_menu_shell_append( GTK_MENU_SHELL( view_menu ), menu_item );
	
	/*
	 Help menu
	 */
	menu_item = gtk_menu_item_new_with_mnemonic( N_("_Help") );
	gtk_menu_item_set_submenu( GTK_MENU_ITEM( menu_item ), help_menu );
	gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), menu_item );
	menu_item = gtk_image_menu_item_new_from_stock( GTK_STOCK_ABOUT, accel_group );
	gtk_menu_shell_append( GTK_MENU_SHELL( help_menu ), menu_item );
	menu_item = gtk_image_menu_item_new_from_stock( GTK_STOCK_HELP, accel_group );
	gtk_menu_shell_append( GTK_MENU_SHELL( help_menu ), menu_item );
	
	return menu_bar;
}